import 'dart:convert';

import 'package:get/get_rx/src/rx_types/rx_types.dart';
import 'package:mziot/generated/json/base/json_field.dart';
import 'package:mziot/generated/json/device_list_entity.g.dart';

@JsonSerializable()
class DeviceListEntity {
  List<DeviceListList>? list;
  bool? hasNext;

  DeviceListEntity();

  factory DeviceListEntity.fromJson(Map<String, dynamic> json) => $DeviceListEntityFromJson(json);

  Map<String, dynamic> toJson() => $DeviceListEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class DeviceListList {
  int? id;
  int? deviceId;
  int? userId;
  String? deviceName;
  String? deviceBluetooth;
  String? deviceSerialnum;
  String? deviceImg;
  int? connectStatus;
  int? deviceLightRate;
  String? groupName;
  bool? lockStatus;
  String? sceneName;
  int? sceneLightRate;
  int? groupId;
  int? sceneId;
  bool? isClose;
  bool? isNetDevice;

  var isSelected = false.obs;
  var lightRate = 0.obs;
  var closeState = false.obs;
  var isBluetooth = false.obs;
  var isWifi = false.obs;
  var isLock = false.obs;

  DeviceListList();

  factory DeviceListList.fromJson(Map<String, dynamic> json) => $DeviceListListFromJson(json);

  Map<String, dynamic> toJson() => $DeviceListListToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
